Expand description
The purpose of this library is to provide an OpenGL Context
on as many
platforms as possible.
Building a WindowedContext<T>
A WindowedContext<T>
is composed of a Window
and an OpenGL
Context
.
Due to some operating-system-specific quirks, glutin prefers control over
the order of creation of the Context
and Window
. Here is an example
of building a WindowedContext<T>
:
let el = glutin::EventsLoop::new();
let wb = glutin::WindowBuilder::new()
.with_title("Hello world!")
.with_dimensions(glutin::dpi::LogicalSize::new(1024.0, 768.0));
let windowed_context = glutin::ContextBuilder::new()
.build_windowed(wb, &el)
.unwrap();
You can, of course, create a RawContext<T>
separately from an existing
window, however that may result in an suboptimal configuration of the window
on some platforms. In that case use the unsafe platform-specific
RawContextExt
available on linux and windows.
You can also produce headless Context
s via the
ContextBuilder::build_headless
function.
Modules
- DPI is important, so read the docs for this module if you don’t want to be confused.
- Contains traits with platform-specific methods in them.
Structs
- An iterator for the list of available monitors.
- Represents an OpenGL
Context
. - A context which has an underlying window, which may or may not be stored separately.
- Identifier of an input device.
- Provides a way to retrieve events from the system and from the windows that were registered to the events loop.
- The error that is returned when an
EventsLoopProxy
attempts to wake up anEventsLoop
that no longer exists. - Used to wake up the
EventsLoop
from another thread. - Attributes to use when creating an OpenGL
Context
. - An icon used for the window titlebar, taskbar, etc.
- Describes a keyboard input event.
- Represents the current state of the keyboard modifiers
- Identifier for a monitor.
- Describes a possible format.
- Describes how the backend should choose a pixel format.
- A type that
Context
s which might possibly be currently current on some thread take as a generic. - Represents touch event
- Represents a window.
- Attributes to use when creating a window.
- Object that allows you to build windows.
- Identifier of a window. Unique for each window.
Enums
- All APIs related to OpenGL that you can possibly get while using glutin.
- Error that can happen when manipulating an OpenGL
Context
. - Returned by the user callback given to the
EventsLoop::run_forever
method. - Error that can happen while creating a window or a headless renderer.
- Represents raw hardware events that are not associated with any particular window.
- Describes the input state of a key.
- Describes a generic event.
- Describes the requested OpenGL
Context
profiles. - Describes the OpenGL API and version that are being requested when a context is created.
- Describes a button of a mouse controller.
- Describes the appearance of the mouse cursor.
- Describes a difference in the mouse scroll wheel state.
- A type that
Context
s which are not currently current on any thread take as a generic. - The behavior of the driver when you change the current context.
- Specifies the tolerance of the OpenGL
Context
to faults. If you accept raw OpenGL commands and/or raw shader code from an untrusted source, you should definitely care about this. - Describes touch-screen input state.
- Symbolic name for a keyboard key.
- Error that can happen while creating a window or a headless renderer.
- Describes an event from a
Window
.
Statics
- The minimum core profile GL context. Useful for getting the minimum required GL version while still running on OSX, which often forbids the compatibility profile features.
Traits
- A trait implemented on both
NotCurrent
andPossiblyCurrent
.
Type Definitions
- Identifier for a specific analog axis on some device.
- Identifier for a specific button on some device.
- Represents an OpenGL
Context
which has an underlying window that is stored separately. - Hardware-dependent keyboard scan code.